﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ViewCamera.Rgbd.CApRgbdConfigWindowCommand
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.Windows.Input;


namespace DnProcessSimulateCommands.ViewCamera.Rgbd;

internal class CApRgbdConfigWindowCommand : ICommand
{
  protected readonly Action m_execute;
  protected readonly Func<bool> m_canExecute;

  public CApRgbdConfigWindowCommand(Action execute)
    : this(execute, (Func<bool>) null)
  {
  }

  public CApRgbdConfigWindowCommand(Action execute, Func<bool> canExecute)
  {
    this.m_execute = execute ?? throw new ArgumentNullException("Execute can't be null");
    this.m_canExecute = canExecute;
  }

  public event EventHandler CanExecuteChanged
  {
    add => CommandManager.RequerySuggested += value;
    remove => CommandManager.RequerySuggested -= value;
  }

  public bool CanExecute(object parameter) => this.m_canExecute == null || this.m_canExecute();

  public void Execute(object parameter) => this.m_execute();
}
